home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tricks of the Mac Game Programming Gurus
/
TricksOfTheMacGameProgrammingGurus.iso
/
More Source
/
C⁄C++
/
Swar
/
stars.c
< prev
next >
Wrap
Text File
|
1994-08-21
|
632b
|
32 lines
#include "swar.h"
InitStars()
{
extern STARREC gStarRecs[MAX_STARS];
short i;
for (i = 0; i < MAX_STARS; i++) {
gStarRecs[i].where.v = RngRnd(0, 479);
gStarRecs[i].where.h = RngRnd(0, 639);
gStarRecs[i].color.red = -1;
gStarRecs[i].color.green = -1;
gStarRecs[i].color.blue = -1;
} /* for */
} /* InitStars() */
DrawStars()
{
short i;
GrafPtr savePort;
extern CGrafPort *gOSPtr;
GetPort(&savePort);
SetPort((GrafPtr)gOSPtr);
for (i = 0; i < MAX_STARS; i++) {
SetCPixel(gStarRecs[i].where.h, gStarRecs[i].where.v, &(gStarRecs[i].color));
} /* for */
SetPort(savePort);
} /* DrawStars() */